﻿/**
 * @file MainForm
 *
 * @brief 
 *
 * @author gyzheng
 *
 * @mail gyazheng@gmail.com
 *
 * @date 07/27/2011 22:37:51 
 *
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CarFrameWork.Common;

namespace CarFrameWork.UI.Common
{
    public partial class DetailForm : Form
    {
        public DetailForm()
        {
            Global.skinFramework = new AxXtremeSkinFramework.AxSkinFramework();
            ((System.ComponentModel.ISupportInitialize)(Global.skinFramework)).BeginInit();
            this.Controls.Add(Global.skinFramework);
            ((System.ComponentModel.ISupportInitialize)(Global.skinFramework)).EndInit();
            Global.skinFramework.LoadSkin(Global.skinFolder, "Normalblue.ini");
            InitializeComponent();
        }

        /// <summary>
        /// skin在加载时
        /// </summary>
        /// <param name="e"></param>
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);
            if (this.Visible)
            {
                Global.skinFramework.ApplyWindow(this.Handle.ToInt32());
                this.BackColor = Global.skinFramework.GetColor(XtremeSkinFramework.XTPColorManagerColor.STDCOLOR_BTNFACE);
            }
        }

        /// <summary>
        /// skin在结束时
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
        }

        private void DetailForm_Load(object sender, EventArgs e)
        {}

        protected void SetReadOnly(TextBox control, bool isWrite, Color colors)
        {
            control.ReadOnly = isWrite;
            control.BackColor = colors;
        }

        protected void SetEnable(Control control, bool isEnable)
        {
            control.Enabled = isEnable;
        }

        protected void SetTitle( string formName)
        {
            this.Text = formName;
        }

        private void tbcCancel_Commanded(object sender, EventArgs e)
        {
            if (MsgHelper.ShowQuestionMsgBox("你要取消本次操作吗?") == DialogResult.Yes)
            {
                this.DialogResult = DialogResult.OK;
            }
        }
    }
}
